<?php
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
if($_RQ['op']=='list'){
	$fenlei=pdo_getall('core_account_article_fenlei',array('uniacid'=>$_SESSION['uniacid'],'plugin_name'=>'jy_weishop'),array('id','title'),'id');
	$params=array('ishelp'=>0,'uniacid'=>$_SESSION['uniacid']);
	$fenleiid=intval($_RQ['fenlei']);
	if($fenleiid){
		$params['fenlei']=$fenleiid;
	}
	if($_RQ['title']){
		$params['title like']='%'.trim($_RQ['title']).'%';
		$return['params']['title']=$_RQ['title'];
	}
	$fields=array('id','title','fenlei','pic_url','keyword','createtime','readnum','likenum','status','content');
	$orderby=array();
	$pindex = max(1, intval($_RQ['page']));
	if($_RQ['num']){
		$psize = $_RQ['num'];
	}else{
		$psize = 10;
	}
	$total='';
	$list=pdo_getslice('core_account_article',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['content'] = strip_tags(str_replace('&nbsp;','',$item['content']));
			$item['desc'] = $item['desc'] ? $item['desc'] : cfc('tools')->substr($item['content'],0,36);
			$item['createtime']=date('Y/m/d H:i:s',$item['createtime']);
			$item['url']=custom_url('jy_weishop/news.list/detail/id='.$item['id'],true);
		}
	}
	$return['list']=$list;
	set_html('title','关于我们');
	exi($return);
}
